<%@ Language=VBScript %>
<%Option Explicit%>

<!--#include file="../cons.asp"-->
<!--#include file="../../Common/Database.asp"-->

<%
	response.CacheControl = "no-cache"
	
	Dim oRSAlumnos
	Dim IdCurso, PT, ST, TT, Diciembre, Marzo, Ranking, SoloCurri, Sort, ConNotasD
	
	IdCurso = request("IdCurso")
	PT = request("PT")
	ST = request("ST")
	TT = request("TT")
	Diciembre = request("Diciembre")
	Marzo = request("Marzo")
	Ranking = request("Ranking")
	SoloCurri = request("SoloCurri")
	Sort = request("Sort")
	ConNotasD = request("ConNotasD")

	DecideFuncion()	
	
	%>
	<table cellpadding=0 cellspacing=0 width=100% height=100% style="border-collapse: collapse; font-family: Verndana; font-size: 12px; font-weight: bold; color: white;">
		<tr valign="top">
			<td onclick="Sort(this);" img="imgSortAp" style="cursor: hand; background-color: #666666; width: 250px; height: 15px;">Apellido y Nombre&nbsp;&nbsp;<%=WriteSortImg("imgSortAp")%></td>
			<td onclick="Sort(this);" img="imgSortCurso" style="cursor: hand; background-color: #666666;">Curso&nbsp;&nbsp;<%=WriteSortImg("imgSortCurso")%></td>
			<%if (PT = "false" and ST = "false" and TT = "false" and Diciembre = "false" and Marzo = "false" and Ranking = "off") then%>
				<td style="cursor: hand; background-color: #666666;">Prom.</td>
			<%else%>
				<%if (Diciembre = "false" or Marzo = "false") and (Ranking = "off") then%>
					<td style="background-color: #666666; text-align: center;">Cant.</td>
				<%else%>
					<td onclick="Sort(this);" img="imgSortProm" style="cursor: hand; background-color: #666666;">Prom.&nbsp;&nbsp;<%=WriteSortImg("imgSortProm")%></td>
					<td onclick="Sort(this);" img="imgSortDi" style="cursor: hand; background-color: #666666;">Di&nbsp;&nbsp;<%=WriteSortImg("imgSortDi")%></td>
					<td onclick="Sort(this);" img="imgSortMa" style="cursor: hand; background-color: #666666;">Ma&nbsp;&nbsp;<%=WriteSortImg("imgSortMa")%></td>
				<%end if%>
			<%end if%>
			<td id="noprint" style="background-color: #666666; text-align: center;">Plan.</td>
			<td style="background-color: #666666; text-align: center; width: 5px;">&nbsp;</td>
		</tr>
		<tr valign="top">
			<td colspan=7>
				<div class="DivLA">
		<table id="TAlumnos" cellpadding=0 cellspacing=0 width=100% style="border-collapse: collapse; font-family: Verndana; font-size: 12px;">
		<%
			while not oRSAlumnos.EOF
				response.Write "<tr id=""" & oRSAlumnos("IdAlumno") & """>"
				response.Write "<td width=""250px"" height=""25"">" & server.HTMLEncode(oRSAlumnos("Apellido")) & ", " & oRSAlumnos("Nombre") & "</td>"
				response.Write "<td style=""text-align: center;"">" & oRSAlumnos("CursoDescrip") & "</td>"
				if (PT = "false" and ST = "false" and TT = "false" and Diciembre = "false" and Marzo = "false" and Ranking = "off") then
					response.Write "<td style=""text-align: center;"">" & GetNotaDecCol(oRSAlumnos("promnota"),2) & "</td>"
				else
					if (Diciembre = "false" or Marzo = "false") and (Ranking = "off") then
						response.Write "<td style=""text-align: center;"">" & oRSAlumnos("cant") & "</td>"
					else
						response.Write "<td style=""text-align: center;"">" & GetNotaDecCol(oRSAlumnos("promnota"),2) & "</td>"
						response.Write "<td style=""text-align: center;"">" & oRSAlumnos("cantD") & "</td>"
						response.Write "<td style=""text-align: center;"">" & oRSAlumnos("cantM") & "</td>"
					end if
				end if
				response.Write "<td colspan=""2"" id=""noprint"" style=""text-align: center;""><img src=""../../images/ico_PlanSeg.gif"" title=""Planilla de Seguimiento"" style=""cursor: hand;"" onclick=""EnPantalla(" & oRSAlumnos("IdAlumno") & "," & oRSAlumnos("IdCurso") & ");""></img></td>"
				response.Write "</tr>"
				
				oRSAlumnos.MoveNext()
			wend
		%>
		</table>
		</div>
		</td>
		</tr>
	</table>
<%
Private function WriteSortImg(img)

	Dim aSort

	aSort = split(Sort,",")
	if ubound(aSort)>=1 then
		if aSort(0) = img then
			if aSort(1) = "0" then
				Response.Write "<img desc=""0"" id=""" & img & """ name=""" & img & """ src=""../../images/FlechaArribaGris.gif"" style=""visibility: ;"">"
			else
				Response.Write "<img desc=""1"" id=""" & img & """ name=""" & img & """ src=""../../images/FlechaAbajoGris.gif"" style=""visibility: ;"">"
			end if
		else
			Response.Write "<img desc=""0"" id=""" & img & """ name=""" & img & """ src=""../../images/FlechaAbajoGris.gif"" style=""visibility: hidden;"">"
		end if
	else
		Response.Write "<img desc=""0"" id=""" & img & """ name=""" & img & """ src=""../../images/FlechaAbajoGris.gif"" style=""visibility: hidden;"">"
	end if
End function


Private function GetListadoAprobaronTODO(IdCurso)
	Dim oConn, sSQL, oRS

	Set oConn = OpenConnection

	sSQL =	"select C.IdCurso, C.CursoDescrip, AC.IdAlumno, A.Apellido, A.Nombre, LP.IdAlumnoCurso, avg(nota) as promnota, count(*) from ListadosProcesados LP " & _
			"inner join AlumnoCurso AC on (LP.IdAlumnoCurso = AC.IdAlumnoCurso) " & _
			"inner join Alumno A on (A.IdAlumno = AC.IdAlumno) " & _
			"inner join MateriaCurso MC on (MC.IdMateriaCurso = AC.IdMateriaCurso) " & _
			"inner join Curso C on (C.IdCurso = MC.IdSedeCurso) " & _
			"where LP.nota is not null "
			if IdCurso <> "T" then
				sSQL = sSQL & " and C.IdCurso = " & IdCurso & " "
			end if
			sSQL = sSQL & "group by AC.IdAlumno " & _
			"having count(*) = (select count(*) from AlumnoCurso AC2 inner join ListadosProcesados LP2 on (AC2.IdAlumnoCurso = LP2.IdAlumnoCurso) where AC.IdAlumno = AC2.IdAlumno group by AC2.IdAlumno) " & _
			"order by promnota desc"
	
	'response.Write sSQL
	'response.End
	Set oRS = oConn.Execute(sSQL)
	
	Set GetListadoAprobaronTODO = oRS
End function

Private function GetListadoRanking(IdCurso)
	Dim oConn, sSQL, oRS

	Set oConn = OpenConnection

	sSQL =	"select C.IdCurso, C.CursoDescrip, AC.IdAlumno, A.Apellido, A.Nombre, LP.IdAlumnoCurso, avg(nota) as promnota, count(*) cant from ListadosProcesados LP " & _
			"inner join AlumnoCurso AC on (LP.IdAlumnoCurso = AC.IdAlumnoCurso) " & _
			"inner join Alumno A on (A.IdAlumno = AC.IdAlumno) " & _
			"inner join MateriaCurso MC on (MC.IdMateriaCurso = AC.IdMateriaCurso) " & _
			"inner join Curso C on (C.IdCurso = MC.IdSedeCurso) " & _
			"inner join ProfesorMateria PM on (PM.IdProfesorMateria = MC.ProfesorMateria) " & _
			"inner join Materia M on (M.IdMateria= PM.IdMateria) " & _
			"where (LP.nota is null and LP.Marzo is null) "
			if IdCurso <> "T" then
				sSQL = sSQL & " and C.IdCurso = " & IdCurso & " "
			end if
			if SoloCurri = "true" then
				sSQL = sSQL & " and M.TipoMateria = '" & C & "' "
			end if
			sSQL = sSQL & "group by AC.IdAlumno " & _
			"order by cant"
	
	'response.Write sSQL
	'response.End
	Set oRS = oConn.Execute(sSQL)
	
	Set GetListadoRanking = oRS
End function

Private function GetRanking(IdCurso)
	Dim oConn, sSQL, oRS

	Set oConn = OpenConnection

	sSQL =	"select C.IdCurso, C.CursoDescrip, AC.IdAlumno, A.Apellido, A.Nombre, LP.IdAlumnoCurso, avg(nota) as promnota, count(*) as contA from ListadosProcesados LP " & _
			"inner join AlumnoCurso AC on (LP.IdAlumnoCurso = AC.IdAlumnoCurso) " & _
			"inner join Alumno A on (A.IdAlumno = AC.IdAlumno) " & _
			"inner join MateriaCurso MC on (MC.IdMateriaCurso = AC.IdMateriaCurso) " & _
			"inner join Curso C on (C.IdCurso = MC.IdSedeCurso) "
			if SoloCurri = "true" then
				sSQL = sSQL &	"inner join ProfesorMateria PM on (PM.IdProfesorMateria = MC.IdProfesorMateria) " & _
								"inner join Materia M on (M.IdMateria= PM.IdMateria and M.TipoMateria = 'C') "
			end if
			sSQL = sSQL & "where LP.nota is not null "
			if IdCurso <> "T" then
				sSQL = sSQL & " and C.IdCurso = " & IdCurso & " "
			end if
			sSQL = sSQL & "group by AC.IdAlumno " & _
			"having count(*) = (select count(*) from AlumnoCurso AC2 inner join ListadosProcesados LP2 on (AC2.IdAlumnoCurso = LP2.IdAlumnoCurso) "
			if SoloCurri = "true" then
				sSQL = sSQL &	" inner join MateriaCurso MC on (MC.IdMateriaCurso = AC2.IdMateriaCurso) " & _
								"inner join ProfesorMateria PM on (PM.IdProfesorMateria = MC.IdProfesorMateria) " & _
								"inner join Materia M on (M.IdMateria= PM.IdMateria and M.TipoMateria = 'C') "
			end if			
			sSQL = sSQL & "where AC.IdAlumno = AC2.IdAlumno group by AC2.IdAlumno) " & _
			"order by promnota desc"
	
	'response.Write sSQL
	'response.End
	Set oRS = oConn.Execute(sSQL)
	
	Dim objRecordset
	set objRecordset=Server.CreateObject("ADODB.recordset")

	objRecordset.Fields.Append "IdCurso", 3
	objRecordset.Fields.Append "CursoDescrip", 200, 300
	objRecordset.Fields.Append "IdAlumno", 3
	objRecordset.Fields.Append "Apellido", 200, 300
	objRecordset.Fields.Append "Nombre", 200, 300
	objRecordset.Fields.Append "IdAlumnoCurso", 3
	objRecordset.Fields.Append "promnota", 5
	objRecordset.Fields.Append "cantD", 3
	objRecordset.Fields.Append "cantM", 3
	objRecordset.Open
	
	while not oRS.EOF
		objRecordset.AddNew
		
		objRecordset.Fields("IdCurso") = oRS(0)
		objRecordset.Fields("CursoDescrip") = oRS(1)
		objRecordset.Fields("IdAlumno") = oRS(2)
		objRecordset.Fields("Apellido") = oRS(3)
		objRecordset.Fields("Nombre") = oRS(4)
		objRecordset.Fields("IdAlumnoCurso") = oRS(5)
		objRecordset.Fields("promnota") = oRS(6)
		objRecordset.Fields("cantD") = 0
		objRecordset.Fields("cantM") = 0
		oRS.MoveNext()
	wend

	Set oRS = GetListadoseLlevaronaDiciembreyMarzo()
	
	while not oRS.EOF
		objRecordset.AddNew
		
		objRecordset.Fields("IdCurso") = oRS(0)
		objRecordset.Fields("CursoDescrip") = oRS(1)
		objRecordset.Fields("IdAlumno") = oRS(2)
		objRecordset.Fields("Apellido") = oRS(3)
		objRecordset.Fields("Nombre") = oRS(4)
		objRecordset.Fields("IdAlumnoCurso") = oRS(5)
		objRecordset.Fields("promnota") = 0
		objRecordset.Fields("cantD") = oRS("cantD")
		objRecordset.Fields("cantM") = oRS("cantM")
		oRS.MoveNext()
	wend
	
	objRecordset.Sort = GetSort()
	objRecordset.MoveFirst
	'response.Write objRecordset.RecordCount
	Set GetRanking = objRecordset 'oRS
End function

Private function GetSort()
	Dim aSort, index, descasc

	descasc = ""
	index = "CursoDescrip, Apellido"
	aSort = split(Sort,",")
	if ubound(aSort)>=1 then
		if aSort(1) = 1 then descasc = " DESC"
		if aSort(0) = "imgSortAp" then index = "Apellido" & descasc & ", Nombre"
		if aSort(0) = "imgSortCurso" then index = "CursoDescrip"
		if aSort(0) = "imgSortProm" then index = "promnota"
		if aSort(0) = "imgSortDi" then index = "cantD"
		if aSort(0) = "imgSortMa" then index = "cantM"
	end if

	GetSort = index & descasc
End function

Private function GetListadoAlgoseLlevaron(IdCurso, PT, ST, TT, Marzo)
	Dim oConn, sSQL, oRS

	Set oConn = OpenConnection

	sSQL =	"select C.IdCurso, C.CursoDescrip, AC.IdAlumno, A.Apellido, A.Nombre, LP.IdAlumnoCurso, count(*) cant from ListadosProcesados LP " & _
			"inner join AlumnoCurso AC on (LP.IdAlumnoCurso = AC.IdAlumnoCurso) " & _
			"inner join Alumno A on (A.IdAlumno = AC.IdAlumno) " & _
			"inner join MateriaCurso MC on (MC.IdMateriaCurso = AC.IdMateriaCurso) " & _
			"inner join Curso C on (C.IdCurso = MC.IdSedeCurso) " & _
			"where LP.nota is null "
			if PT = "true" then sSQL = sSQL & "and LP.1T = '1' "
			if ST = "true" then sSQL = sSQL & "and LP.2T = '1' "
			if PT = "true" then sSQL = sSQL & "and LP.3T = '1' "
			if Marzo = "true" then sSQL = sSQL & "and LP.Marzo = '1' "
			if IdCurso <> "T" then
				sSQL = sSQL & " and C.IdCurso = " & IdCurso & " "
			end if
			sSQL = sSQL & "group by AC.IdAlumno " & _
			"order by C.CursoDescrip, cant"
	
	'response.Write sSQL
	'response.End
	Set oRS = oConn.Execute(sSQL)
		
	Set GetListadoAlgoseLlevaron = oRS
End function

Private function GetListadoAlgoseLlevaronenDiciembre()
	Dim oConn, sSQL, oRS

	Set oConn = OpenConnection

	sSQL =	"select C.IdCurso, C.CursoDescrip, AC.IdAlumno, A.Apellido, A.Nombre, LP.IdAlumnoCurso, count(*) cant from ListadosProcesados LP " & _
			"inner join AlumnoCurso AC on (LP.IdAlumnoCurso = AC.IdAlumnoCurso) " & _
			"inner join Alumno A on (A.IdAlumno = AC.IdAlumno) " & _
			"inner join MateriaCurso MC on (MC.IdMateriaCurso = AC.IdMateriaCurso) " & _
			"inner join Curso C on (C.IdCurso = MC.IdSedeCurso) " & _
			"where LP.nota is null " & _
			"and LP.Marzo is null "
			if IdCurso <> "T" then
				sSQL = sSQL & " and C.IdCurso = " & IdCurso & " "
			end if
			sSQL = sSQL & "group by AC.IdAlumno " & _
			"order by C.CursoDescrip"
	
	Set oRS = oConn.Execute(sSQL)
	
	Set GetListadoAlgoseLlevaronenDiciembre = oRS
End function

Private function GetListadoseLlevaronaDiciembreyMarzo()
	Dim oConn, sSQL, oRS

	Set oConn = OpenConnection

	if ConNotasD = "false" then
		sSQL =	"select C.IdCurso, C.CursoDescrip, AC.IdAlumno, A.Apellido, A.Nombre, LP.IdAlumnoCurso, count(*) cantD from ListadosProcesados LP " & _
				"inner join AlumnoCurso AC on (LP.IdAlumnoCurso = AC.IdAlumnoCurso) " & _
				"inner join Alumno A on (A.IdAlumno = AC.IdAlumno) " & _
				"inner join MateriaCurso MC on (MC.IdMateriaCurso = AC.IdMateriaCurso) " & _
				"inner join Curso C on (C.IdCurso = MC.IdSedeCurso) "
				if SoloCurri = "true" then
					sSQL = sSQL &	"inner join ProfesorMateria PM on (PM.IdProfesorMateria = MC.IdProfesorMateria) " & _
									"inner join Materia M on (M.IdMateria= PM.IdMateria and M.TipoMateria = 'C') "
				end if
				sSQL = sSQL & "where LP.nota is null " & _
				"and LP.Marzo is null "
				if IdCurso <> "T" then
					sSQL = sSQL & " and C.IdCurso = " & IdCurso & " "
				end if
				sSQL = sSQL & "group by AC.IdAlumno"
	else
		sSQL =	"select * from listadosprocesadosd LPD "

	end if
			
			'response.Write sSQL
			'response.End
	
	Set oRS = oConn.Execute(sSQL)
	
	Dim oRSDicMar
	set oRSDicMar=Server.CreateObject("ADODB.recordset")

	oRSDicMar.Fields.Append "IdCurso", 3
	oRSDicMar.Fields.Append "CursoDescrip", 200, 300
	oRSDicMar.Fields.Append "IdAlumno", 3
	oRSDicMar.Fields.Append "Apellido", 200, 300
	oRSDicMar.Fields.Append "Nombre", 200, 300
	oRSDicMar.Fields.Append "IdAlumnoCurso", 3
	oRSDicMar.Fields.Append "promnota", 5
	oRSDicMar.Fields.Append "cantD", 3
	oRSDicMar.Fields.Append "cantM", 3
	
	oRSDicMar.Open
	
	while not oRS.EOF
		oRSDicMar.AddNew
		
		oRSDicMar.Fields("IdCurso") = oRS("IdCurso")
		oRSDicMar.Fields("CursoDescrip") = oRS("CursoDescrip")
		oRSDicMar.Fields("IdAlumno") = oRS("IdAlumno")
		oRSDicMar.Fields("Apellido") = oRS("Apellido")
		oRSDicMar.Fields("Nombre") = oRS("Nombre")
		oRSDicMar.Fields("IdAlumnoCurso") = oRS("IdAlumnoCurso")
			if ConNotasD = "false" then
			oRSDicMar.Fields("promnota") = oRS("cantD")
			else
			oRSDicMar.Fields("promnota") = oRS("notad")
			end if
		oRSDicMar.Fields("cantD") = oRS("cantD")
		oRSDicMar.Fields("cantM") = 0
		oRS.MoveNext()
	wend
	
	if ConNotasD = "false" then
		sSQL =	"select C.IdCurso, C.CursoDescrip, AC.IdAlumno, A.Apellido, A.Nombre, LP.IdAlumnoCurso, count(*) cantM from ListadosProcesados LP " & _
				"inner join AlumnoCurso AC on (LP.IdAlumnoCurso = AC.IdAlumnoCurso) " & _
				"inner join Alumno A on (A.IdAlumno = AC.IdAlumno) " & _
				"inner join MateriaCurso MC on (MC.IdMateriaCurso = AC.IdMateriaCurso) " & _
				"inner join Curso C on (C.IdCurso = MC.IdSedeCurso) "
				if SoloCurri = "true" then
					sSQL = sSQL &	"inner join ProfesorMateria PM on (PM.IdProfesorMateria = MC.IdProfesorMateria) " & _
									"inner join Materia M on (M.IdMateria= PM.IdMateria and M.TipoMateria = 'C') "
				end if
				sSQL = sSQL & "where LP.nota is null " & _
				"and LP.Marzo = '1' "
				if IdCurso <> "T" then
					sSQL = sSQL & " and C.IdCurso = " & IdCurso & " "
				end if
				sSQL = sSQL & "group by AC.IdAlumno"
	else
		sSQL =	"select * from listadosprocesadosm LPM "
	end if
			
			'response.Write sSQL
			'response.End
	
	Set oRS = oConn.Execute(sSQL)
	
	while not oRS.EOF
		oRSDicMar.MoveFirst
		oRSDicMar.find("IdAlumno=" & oRS("IdAlumno"))
		if not oRSDicMar.EOF then
			oRSDicMar.Fields("cantM") = oRS("cantM")
		else
			oRSDicMar.AddNew
		
			oRSDicMar.Fields("IdCurso") = oRS("IdCurso")
			oRSDicMar.Fields("CursoDescrip") = oRS("CursoDescrip")
			oRSDicMar.Fields("IdAlumno") = oRS("IdAlumno")
			oRSDicMar.Fields("Apellido") = oRS("Apellido")
			oRSDicMar.Fields("Nombre") = oRS("Nombre")
			oRSDicMar.Fields("IdAlumnoCurso") = oRS("IdAlumnoCurso")
			if ConNotasD = "false" then
			oRSDicMar.Fields("promnota") = oRS("cantM")
			else
			oRSDicMar.Fields("promnota") = oRS("notam")
			end if
			oRSDicMar.Fields("cantD") = 0
			oRSDicMar.Fields("cantM") = oRS("cantM")
		end if
		
		oRS.MoveNext()
	wend
	
	oRSDicMar.MoveFirst

	if ConNotasD = "true" then
		' Para los que aprobaron todo en Diciembre
		sSQL =	"select LP.IdAlumnoCurso, (Prom1T+Prom2T+Prom3T)/3, LP.Prom1T, LP.Prom2T, Prom3T, count(*) cantD, C.IdCurso, A.IdAlumno, A.Apellido, A.Nombre, C.CursoDescrip " & _
				"from ListadosProcesados LP " & _
				"inner join AlumnoCurso AC on (LP.IdAlumnoCurso = AC.IdAlumnoCurso) " & _
				"inner join Alumno A on (A.IdAlumno = AC.IdAlumno) " & _
				"inner join MateriaCurso MC on (MC.IdMateriaCurso = AC.IdMateriaCurso) " & _
				"inner join Curso C on (C.IdCurso = MC.IdSedeCurso) " & _
				"where LP.nota is null " & _
				"and LP.Marzo is null " & _
				"and A.IdAlumno not in (select LPD.IdAlumno from listadosprocesadosd LPD) " & _
				"and A.IdAlumno not in (select LPM.IdAlumno from listadosprocesadosd LPM) " & _
				"group by AC.IdAlumno " & _
				"order by CursoDescrip, Apellido"
		
		Set oRS = oConn.Execute(sSQL)
		
		while not oRS.EOF
			oRSDicMar.MoveFirst
			oRSDicMar.find("IdAlumno=" & oRS("IdAlumno"))
			if not oRSDicMar.EOF then
				oRSDicMar.Fields("cantD") = 0
			else
				oRSDicMar.AddNew
			
				oRSDicMar.Fields("IdCurso") = oRS("IdCurso")
				oRSDicMar.Fields("CursoDescrip") = oRS("CursoDescrip")
				oRSDicMar.Fields("IdAlumno") = oRS("IdAlumno")
				oRSDicMar.Fields("Apellido") = oRS("Apellido")
				oRSDicMar.Fields("Nombre") = oRS("Nombre")
				oRSDicMar.Fields("IdAlumnoCurso") = oRS("IdAlumnoCurso")
				oRSDicMar.Fields("promnota") = 0
				oRSDicMar.Fields("cantD") = 0
				oRSDicMar.Fields("cantM") = 0
			end if
			
			oRS.MoveNext()
		wend
	end if
	
	oRSDicMar.MoveFirst
	
	Set GetListadoseLlevaronaDiciembreyMarzo = oRSDicMar
End function


Public function GetNotaDecCol(nota, idec)
	Dim sNota, iNotaConvert
	
	iNotaConvert = FormatNumber(nota, idec)
	
	sNota = "<font color="""
	if iNotaConvert >= 0 and iNotaConvert < 4 then
		sNota = sNota & "red"
	end if
	
	if iNotaConvert >= 4 and iNotaConvert < 6 then
		sNota = sNota & "green"
	end if
	
	if iNotaConvert >= 6 and iNotaConvert <= 10 then
		sNota = sNota & "blue"
	end if

	if iNotaConvert = 0 then
		iNotaConvert = "-"
	end if
		
	sNota = sNota & """>" & iNotaConvert & "</font>"
	GetNotaDecCol = sNota
End function

Private function DecideFuncion()
	if PT = "false" and ST = "false" and TT = "false" and Diciembre = "false" and Marzo = "false" and Ranking = "off" then
		Set oRSAlumnos = GetListadoAprobaronTODO(IdCurso)
		exit function
	end if
	
	if Diciembre = "true" and Marzo = "false" then
		Set oRSAlumnos = GetListadoAlgoseLlevaronenDiciembre()
		exit function
	end if

	if Diciembre = "true" and Marzo = "true" then
		Set oRSAlumnos = GetListadoseLlevaronaDiciembreyMarzo()
		exit function
	end if
	
	if Ranking = "on" then
		Set oRSAlumnos = GetRanking(IdCurso)
		exit function
	end if
	
	
		Set oRSAlumnos = GetListadoAlgoseLlevaron(IdCurso, PT, ST, TT, Marzo)
End function

%>